#! /usr/bin/env python 
#coding=utf-8
from  flask import Blueprint
from flask import request

from view import user_view as uv
from model.user import User
from util import json_util as ju


user_ctrl=Blueprint('user', __name__, url_prefix="/login")

#print(user_ctrl.name)

@user_ctrl.route("/")
def get_users():
    return uv.get_users()

@user_ctrl.route("/add",methods=['POST'])
def add_user():
    data=request.form

    #request.data
    #print(u.id)
    #todo
    return uv.add_user(data.to_dict())

@user_ctrl.route("/account",methods=['POST'])
def login_user():
    data=request.form
    print(data)
    return ju.to_sucess(data,1)